﻿using System;
using System.Data;
using System.Linq;
using System.Web.UI.WebControls;
using ASPNETVN.PORTAL.Components.UI;
using System.Collections;
using System.Collections.Generic;
using System.Web.UI;
using System.Web;
using ASPNETVN.PORTAL.Components.Security;
using ASPNETVN.PORTAL.Components.Share;
using LMHTX.Modules.DIRECTORY.COOPERATIVE.Components;

namespace LMHTX.Modules.DIRECTORY.COOPERATIVE.Controls
{
    public partial class TrainingTypeManager : AddEditItemControl
    {
        protected override void OnInit(EventArgs e)
        {
            this.ButtonUpdate = btnAdd;
            this.ButtonCancel = btnCancel;

            this.Update += TypeManager_Update;
            base.OnInit(e);
        }

        void TypeManager_Update(object sender, EventArgs e)
        {
            TrainingType item = new TrainingType();
            item.Title = txtTitle.Text;
            item.Description = txtDescription.Text;
            item.ModuleID = this.ModuleID;
            item.Insert();
            gvTraining.DataBind();
            
            this.ResetInputData();
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        private void ResetInputData()
        {
            txtTitle.Text = "";
            txtDescription.Text = "";
        }
    }
}